<?php
/**
 * Created by PhpStorm.
 * User: suruixiang
 * Date: 2017/9/29
 * Time: 下午4:01
 */
namespace app\common\exception;

use Exception;
use think\exception\Handle;
use think\exception\HttpException;
class Http extends Handle
{

    public function render(Exception $e)
    {
        // 请求异常
        if (request()->isPost()) {
            return response($e->getMessage(), $e->getStatusCode(), [
                'Content-Type' => 'application/json'
            ]);
        }
        //可以在此交由系统处理
        return parent::render($e);
    }

}